using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using Framework.Module.CMS.Library.Distributions;
using Framework.Module.CMS.Library.Comments;

namespace Framework.Module.CMS.Web.HomePage
{
    public partial class ListComment : System.Web.UI.UserControl
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                int distid;
                try
                {
                    distid = int.Parse(Request.QueryString["distid"]);
                }
                catch
                {
                    distid = 0;
                }
                if (distid != 0)
                {
                    int contentid = DistributionController.GetDistribution(distid).Distribution_ContentID;
                    DataTable dtComments = CommentDB.GetByContentID(contentid, true, 10);
                    grdComment.DataSource = dtComments;
                    grdComment.DataBind();

                    if (grdComment.Rows.Count == 0) this.Visible = false;
                }
                
            }
        }
    }
}